package Twice.day05;

/**
 * @Author: lya
 * @Description: 本类的作用描述:
 * @CreateDate: 2019/8/27
 * @Version: 1.0
 */
public class ToStringDemo {
    public static void main(String[] args) {
        Student s = new Student(10,"lya");
        System.out.println(s);//Twice.day05.Student@4554617c
        System.out.println(s.toString());//Twice.day05.Student@4554617c

        //toString()底层 return getClass().getName() + "@" + Integer.toHexString(hashCode());

        //Twice.day05.Student@4554617c
        System.out.println(s.getClass().getName() + "@" + Integer.toHexString(s.hashCode()));

        System.out.println("================");

        String str = new String("hello");
        System.out.println(str);
        //java.lang.String 它的父类也是java.lang.Object
        System.out.println(str.toString());
    }
}
